﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Popup.Master" CodeBehind="ForecastsPO.aspx.cs"
    Inherits="VSM.ForecastsPO" EnableEventValidation="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function isNumberKey(sender, evt) {
            var txt = sender.value;
            var dotcontainer = txt.split('.');
            var charCode = (evt.which) ? evt.which : event.keyCode;
            if (!(dotcontainer.length == 1 && charCode == 46) && charCode > 31 && (charCode < 48 || charCode > 57))
                return false;
            return true;
        }
    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:HiddenField ID="hdnDocEntry" runat="server" />
                <asp:HiddenField ID="hdnPODate" runat="server" />
                <asp:HiddenField ID="hdnStatus" runat="server" />
                <div style="height: 490px; overflow: scroll">
                    <table id="Table1" width="100%" style="font-weight: bold">
                        <tr>
                            <td class="FormLineItemAlt" valign="middle" colspan="4">
                                <asp:Button ID="btnAddItems" runat="server" Text="Add vehicle"
                                    
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    Width="85px" onclick="btnAddItems_Click" />
                            </td>
                        </tr>
                    </table>
                    <table style="width: 100%; border: 1px;" cellpadding="3" cellspacing="0">
                        <tr>
                            <td colspan="2" style="text-align: center;">
                                <asp:GridView ID="grvFCPO" CssClass="GridInner" runat="server" Width="100%" BorderColor="White"
                                    BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                                    HeaderStyle-Height="27px" OnRowCreated="grvFCPO_RowCreated" 
                                    CellSpacing="2" HeaderStyle-VerticalAlign="Middle"
                                    AllowPaging="True" OnPageIndexChanging="grdFCPO_PageIndexChanging" 
                                    PageSize="20" OnRowDataBound="grdFCPO_RowDataBound">
                                    <PagerSettings Mode="NumericFirstLast" />
                                    <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                                    <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                                    <Columns>
                                        <asp:CommandField HeaderText="Action" ShowDeleteButton="True" ShowEditButton="False"
                                            Visible="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="70px" />

                                        <asp:TemplateField HeaderText="Action">
                                            <ItemStyle HorizontalAlign="Center"  Width="50px" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:LinkButton ID="lnkDelete" runat="server" Text="Delete" TabIndex="-1" OnClick="lnkDelete_Click"></asp:LinkButton>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="#">
                                            <ItemStyle HorizontalAlign="Center" Width="20px" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblNo" runat="server" Text='<%# Bind("No") %>' BorderStyle="none">
                                                </asp:Label>
                                                <asp:HiddenField ID="hdnInternalID" runat="server" Value='<%# Bind("internal_id") %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Model">
                                            <ItemStyle HorizontalAlign="Center"/>
                                            <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                            <HeaderTemplate>
                                                <asp:label ID="lblHeaderModel" runat="Server" Text="Model" />
                                                <asp:label ID="lblModelRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:DropDownList ID="ddlModel" AutoPostBack="true" onselectedindexchanged="ddlModel_SelectedIndexChanged" style="width: 98%;" runat="server">
                                                </asp:DropDownList>
                                                <asp:HiddenField ID="hdnModel" runat="server" Value='<%# Bind("Model") %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Product">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                            <HeaderTemplate>
                                                <asp:label ID="lblHeaderProduct" runat="Server" Text="Product" />
                                                <asp:label ID="lblProductRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:DropDownList ID="ddlProduct" AutoPostBack="true" onselectedindexchanged="ddlProduct_SelectedIndexChanged" style="width: 98%;" runat="server">
                                                </asp:DropDownList>
                                                <asp:HiddenField ID="hdnProduct" runat="server" Value='<%# Bind("Product") %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Month 1">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle VerticalAlign="Middle" Width="60px" />
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtQty1" runat="server" Width="97%" Text='<%# Bind("Qty1") %>'
                                                    AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" Style="text-align: right" OnTextChanged="txtQty1_OnTextChanged"/>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Month 2">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle VerticalAlign="Middle" Width="60px" />
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtQty2" runat="server" Width="97%" Text='<%# Bind("Qty2") %>'
                                                    AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" Style="text-align: right" OnTextChanged="txtQty2_OnTextChanged"/>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Month 3">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle VerticalAlign="Middle" Width="60px" />
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtQty3" runat="server" Width="97%" Text='<%# Bind("Qty3") %>'
                                                    AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" Style="text-align: right" OnTextChanged="txtQty3_OnTextChanged"/>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Month 4">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle VerticalAlign="Middle" Width="60px" />
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtQty4" runat="server" Width="97%" Text='<%# Bind("Qty4") %>'
                                                    AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" Style="text-align: right" OnTextChanged="txtQty4_OnTextChanged"/>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                    </Columns>
                                    <HeaderStyle BackColor="#6095C9" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False" Height="27px" VerticalAlign="Bottom" />
                                    <EmptyDataTemplate>
                                        <table class="GridInner" style="width: 100%; border-color: White;" border="1" rules="all" cellspacing="2" cellpadding="2">
                                            <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none; background-color: rgb(96, 149, 201);">
                                                <th>
                                                    <span>Action</span>
                                                </th>
                                                <th>
                                                    <span>#</span>
                                                </th>
                                                <th>
                                                    <span>Model</span>
                                                </th>
                                                <th>
                                                    <span>Product</span>
                                                </th>
                                                <th>
                                                    <span>Month 1</span>
                                                </th>
                                                <th>
                                                    <span>Month 2</span>
                                                </th>
                                                <th>
                                                    <span>Month 3</span>
                                                </th>
                                                <th>
                                                    <span>Month 4</span>
                                                </th>
                                            </tr>
                                            <tr>
                                                <td colspan="8">
                                                    <span>No Data</span>
                                                </td>
                                            </tr>
                                        </table>
                                    </EmptyDataTemplate>
                                </asp:GridView>
                            </td>
                        </tr>
                    </table>
                </div>
                <asp:Button ID="btnAccept" runat="server" Text="OK" OnClick="btnAccept_Click" Style="background-image: url('/Images/bgButton.png');
                    background-repeat: no-repeat;" Width="80px" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
